package com.zhang.zxx.easyexcel.pojo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.poi.ss.usermodel.FillPatternType;

import java.util.Date;

/**
 * DemoStyleData:通过注解形式设置写入Excel的样式
 * 头背景设置成红色 IndexedColors.RED.getIndex()
 * 头字体设置成20
 * 内容的背景设置成绿色 IndexedColors.GREEN.getIndex()
 * 内容字体设置成20
 * @author zhangxiaoxiang
 * @date 2021/01/13
 */
@HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 10)
@HeadFontStyle(fontHeightInPoints = 20)
@ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 17)
@ContentFontStyle(fontHeightInPoints = 20)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DemoStyleData {
    /**
     * 字符串的头背景设置成粉红 IndexedColors.PINK.getIndex()
     */
    @HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 14)
    /**
     * 字符串的头字体设置成20
     */
    @HeadFontStyle(fontHeightInPoints = 30)
    /**
     * 字符串的内容的背景设置成天蓝 IndexedColors.SKY_BLUE.getIndex()
     */
    @ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 40)
    /**
     * 字符串的内容字体设置成20
     */
    @ContentFontStyle(fontHeightInPoints = 30)
    @ExcelProperty("字符串标题")
    private String string;
    @ExcelProperty("日期标题")
    private Date date;
    @ExcelProperty("数字标题")
    private Double doubleData;
}
